package com.wc.alorithm_luogu.P1601;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/4/25 16:44
 * @description https://www.luogu.com.cn/problem/P1601
 * Problem（高精）
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String a = sc.next();
        String b = sc.next();

        System.out.println(sum(a, b));
    }

    public static String sum(String a, String b) {
        if (a.length() > b.length()) {
            return sum(b, a);
        }
        StringBuilder ans = new StringBuilder();
        int carry = 0;
        int indexA = a.length() - 1;
        int indexB = b.length() - 1;

        char[] A = a.toCharArray();
        char[] B = b.toCharArray();

        int curSum = 0;

        while (indexA >= 0) {
            curSum = A[indexA] + B[indexB] - '0' + carry;
            if (curSum > '9') {
                carry = 1;
                curSum -= 10;
            } else {
                carry = 0;
            }
            B[indexB] = (char) curSum;
            indexA--;
            indexB--;
        }
        /**
         * B还没整完毕
         */
        while (indexB >= 0) {
            curSum = B[indexB] + carry;
            if (curSum > '9') {
                carry = 1;
                curSum -= 10;
            } else {
                carry = 0;
            }
            B[indexB] = (char) curSum;
            indexB--;
        }

        if (carry == 1) {
            ans.append(1);
        }
        ans.append(B);
        return ans.toString();
    }
}
